package com.alan.api.web;


import com.alan.api.share.dto.common.RequestBase;
import com.alan.api.share.dto.common.ResponseBase;
import com.alan.api.share.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author alan
 * @since 2017-10-29
 */
@RestController
@RequestMapping("/user")
@Validated
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping(value = "register")
    public ResponseBase register(RequestBase request) throws Exception {
        return userService.register(request);
    }

    @RequestMapping(value = "login")
    public ResponseBase login(RequestBase request) throws Exception {
        return userService.login(request);
    }

    @RequestMapping(value = "loginOut")
    public ResponseBase loginOut(RequestBase request) throws Exception {
        return userService.loginOut(request);
    }

}
